classdef SessionData < handle
    %SESSIONDATA Summary of this class goes here
    %   Detailed explanation goes here
    
    properties
        tag
        data
        timestamp
        description
        status
    end
    
    methods
        function obj = SessionData(tag, data, description)
            %SESSIONDATA Construct an instance of this class
            %   Detailed explanation goes here
            if nargin == 2
                description = '';
            end
            obj.tag = tag;
            obj.data = data;
            obj.timestamp = datetime('now');
            obj.description = description;
            obj.status = false;
        end
        
        function disp(obj)
            disp( obj.getInfoTable() );
        end
        
        function obj = setDescription(obj, text)
            obj.description = text;
        end
        
        function obj = setStatus(obj, text)
            obj.status = text;
        end
    end
    
    methods
        function tbl = getInfoTable(obj)            
            v = {'Index', 'Tag',     'Class',      'Bytes',      'Time',  'Description', 'Marked'};
            c = cell(length(obj), length(v));
            for k = 1:length(obj)
                d = obj(k).data; info = whos('d');  totSize = Miscellaneous.GetSize(d);
                c_k = {k, obj(k).tag,   info.class,   totSize,   datestr(obj(k).timestamp), obj(k).description, obj(k).status};
                c(k,:) = c_k;
            end
            tbl = cell2table(c, 'VariableNames', v);
        end
    end
end

